package org.example.base;

import redis.clients.jedis.Jedis;

public class TestHash {
    public static void main(String[] args) {
        Jedis jedis = new Jedis("127.0.0.1", 6379);
        jedis.flushDB();
        System.out.println(jedis.hset("myhash","username","123456"));
        System.out.println(jedis.hset("myhash","username2","123456"));
        System.out.println(jedis.hset("myhash","username3","123456"));
        System.out.println(jedis.hset("myhash","username4","123456"));
        System.out.println(jedis.hset("myhash","username","kkkkkkkk"));
        System.out.println(jedis.hset("中文","username","kkkkkkkk"));
//        System.out.println(jedis.hget("myhash","username3"));
//        System.out.println(jedis.hlen("myhash"));
//        System.out.println(jedis.hdel("myhash","username")); //删除某个字段
        System.out.println(jedis.hgetAll("myhash"));
//        System.out.println(jedis.hkeys("myhash"));
    }
}
